Page({
  data: {
    currentCategory: '常规检查',
    currentItem: '高血压',
    checkItems: [
      '高血压',
      '糖尿病',
      '肝病',
      '腰肌劳损',
      '心血管疾病',
      '骨密度检查',
      '肿瘤标志物'
    ],
    packages: [
      {
        id: 1,
        name: '老年人基础套餐一',
        image: '/static/images/examination-1.jpg',
        price: 399
      },
      {
        id: 2,
        name: '老年人基础套餐一',
        image: '/static/images/examination-1.jpg',
        price: 399
      },
      {
        id: 3,
        name: '老年人基础套餐一',
        image: '/static/images/examination-1.jpg',
        price: 399
      },
      {
        id: 4,
        name: '老年人基础套餐一',
        image: '/static/images/examination-1.jpg',
        price: 399
      },
      {
        id: 5,
        name: '老年人基础套餐一',
        image: '/static/images/examination-1.jpg',
        price: 399
      },
      {
        id: 6,
        name: '老年人基础套餐一',
        image: '/static/images/examination-1.jpg',
        price: 399
      },
      {
        id: 7,
        name: '老年人基础套餐一',
        image: '/static/images/examination-1.jpg',
        price: 399
      }
    ]
  },

  onLoad: function(options) {
    // 页面加载时获取套餐列表
    this.getPackageList()
  },

  // 返回上一页
  goBack: function() {
    wx.navigateBack()
  },

  // 切换检查类别
  switchCategory: function(e) {
    const category = e.currentTarget.dataset.category
    this.setData({
      currentCategory: category
    })
  },

  // 选择检查项目
  selectItem: function(e) {
    const item = e.currentTarget.dataset.item
    this.setData({
      currentItem: item
    })
    this.getPackageList()
  },

  // 获取套餐列表
  getPackageList: function() {
    // 这里应该根据选择的检查项目调用后端API获取相应的套餐列表
    // 目前使用模拟数据
  },

  // 选择套餐
  selectPackage: function(e) {
    const id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: `/pages/services/examination/detail/index?id=${id}`
    })
  }
}) 